package de.hbrs.selectionengine.model;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 * Diese Klasse stellt den schlussendlich aufgestellten Prozess dar, mit den optimalen Services.
 * 
 * @author Sebastian Schmitz, <schmitz82@gmail.com>
 *
 */
@Entity
public class ProcessPlan implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	/**
	 * Contains all services they will used in this processplan.
	 */
	@OneToMany(cascade=CascadeType.ALL, fetch = FetchType.EAGER)
	private List<BPELProcessStep> processSteps;
	/**
	 * The processPlan belongs to an associated BPELProcess.
	 */
	@OneToOne(mappedBy="processPlan")
	private BPELProcess bpelProcess;
	/**
	 * Last refresh of the ProcessPlan.
	 */
	private Timestamp lastRefresh;
	/**
	 * Describes the kind of relation.
	 */
	@OneToOne
	private Constraint constraint;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public List<BPELProcessStep> getProcessSteps() {
		return processSteps;
	}
	public void setProcessSteps(List<BPELProcessStep> webservices) {
		this.processSteps = webservices;
	}
	public BPELProcess getBpelFile() {
		return bpelProcess;
	}
	public void setBpelFile(BPELProcess bpelFile) {
		this.bpelProcess = bpelFile;
	}
	public Timestamp getLastRefresh() {
		return lastRefresh;
	}
	public void setLastRefresh(Timestamp lastRefresh) {
		this.lastRefresh = lastRefresh;
	}
	public BPELProcess getBpelProcess() {
		return bpelProcess;
	}
	public void setBpelProcess(BPELProcess bpelProcess) {
		this.bpelProcess = bpelProcess;
	}
	public Constraint getConstraint() {
		return constraint;
	}
	public void setConstraint(Constraint constraint) {
		this.constraint = constraint;
	}
}
